package org.zfes.snowier.zbss.xzy.router.alert;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.alert.model.AlertMessageHandle;
import org.zfes.snowier.zbss.xzy.biz.alert.service.IAlertMessageHandleService;
import org.zfes.snowier.core.data.SelectVo;
@Controller 
@RequestMapping("/xzy")
public class AlertMessageHandleController implements BaseController {

	
	@Autowired
	private IAlertMessageHandleService alertMessageHandleService;
	
	//@RequiresPermissions(value="alertMessageHandle:loadAlertMessageHandleDataSet",desc="预警消息处理列表")
    @RequestMapping(value="/loadAlertMessageHandleDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadAlertMessageHandleDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  alertMessageHandleService.loadAlertMessageHandleDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="alertMessageHandle:createAlertMessageHandle",desc="预警消息处理添加")
    @RequestMapping(value="/createAlertMessageHandle", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createAlertMessageHandle(@RequestBody AlertMessageHandle alertMessageHandle){
		alertMessageHandleService.createAlertMessageHandle(alertMessageHandle);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="alertMessageHandle:loadAlertMessageHandle",desc="预警消息处理加载")
    @RequestMapping(value="/loadAlertMessageHandle/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadAlertMessageHandle(@PathVariable("id")Long id){
		Optional<AlertMessageHandle> ops = alertMessageHandleService.loadAlertMessageHandleById(id);
		return ajaxQuery("alertMessageHandle",ops);
    }
	
	//@RequiresPermissions(value="alertMessageHandle:updateAlertMessageHandle",desc="预警消息处理更新")
    @RequestMapping(value="/updateAlertMessageHandle", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateAlertMessageHandle(@RequestBody  AlertMessageHandle alertMessageHandle){
		alertMessageHandleService.updateAlertMessageHandle(alertMessageHandle);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="alertMessageHandle:deletAlertMessageHandle",desc="预警消息处理删除")
    @RequestMapping(value="/deleteAlertMessageHandle/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteAlertMessageHandle(@PathVariable("id")Long id){
		alertMessageHandleService.deleteAlertMessageHandle(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }


    @RequestMapping(value="/loadAlertMessageHandleSelectVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadAlertMessageHandleSelectVo(){
		 List<SelectVo>  ops = alertMessageHandleService.loadAlertMessageHandleSelectVo("");
		return ajaxQuery("selectVo",ops);
    }
    
}